package com.zed.games.answer;

import com.zed.api.common.ApplicationContextSupport;
import com.zed.api.games.Action;
import com.zed.api.games.Game;
import com.zed.api.games.GameBuilder;
import com.zed.api.games.GameLevels;

import java.io.Serial;
import java.io.Serializable;
import java.util.Objects;

/**
 * 题库游戏
 *
 * @author Zed
 */
public class AnswerGame extends ApplicationContextSupport implements Game, Serializable {

    @Serial
    private static final long serialVersionUID = 7009635223854073178L;

    private final AnswerGameBuilder gameBuilder;

    private final AnswerGameLevels answerGameLevels;

    public AnswerGame(AnswerGameBuilder gameBuilder) {
        this.gameBuilder = Objects.requireNonNull(gameBuilder, "\"gameBuilder\" cannot be null.");
        this.answerGameLevels = new AnswerGameLevels(gameBuilder.getGameLevels());
    }

    @Override
    public String getName() {
        return "答题游戏";
    }

    @Override
    public GameLevels<?, ? extends Action> getGameLevels() {
        return this.answerGameLevels;
    }


    @Override
    public GameBuilder<?, ? extends Action> getGameBuilder() {
        return this.gameBuilder;
    }
}
